<!DOCTYPE html>
<html>
<head>
	<title>机械电子学院网站后台管理系统</title>
	<meta charset="utf-8"/>
	<link rel="stylesheet" type="text/css" href="{{base_url()}}Public/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="{{base_url()}}Public/css/index.css">
	<script charset="utf-8" src="{{base_url()}}kindeditor/kindeditor-min.js?v=3"></script>
	<script charset="utf-8" src="{{base_url()}}kindeditor/php/upload_json.php"></script>
	<script charset="utf-8" src="{{base_url()}}kindeditor/plugins/autoheight/autoheight.js"></script>
	<script>
		 KindEditor.ready(function(K) {
		 		var options = {
		 			width : '100%',
		 			height : '200px',
		 			items : ['source', '|', 'undo', 'redo', '|', 'justifyleft', 'justifycenter', 'justifyright',
 							'justifyfull', '|', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        					'italic', 'underline', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
        					'insertfile', 'table', 'hr','link', 'unlink', '|',],
        			autoHeightMode : true,
        			filterMode : false,
		 		}
                window.editor = K.create('textarea[name="Content"]', options);
        });
	</script>
	
	<style>
	    .crop-container
	    {
	        
	    }
	    .action
	    {
	        width: 100%;
	        height: 30px;
	        margin: 10px 0;
	    }
	    .cropped>img
	    {
	        margin-right: 10px;
	    }
	</style>
</head>
<body>
	<div class="navbar navbar-default navbar-fixed-top" style="background-color: #fff;border-color: #fff;">
		<div class="container">
			<div class="navbar-header">
				<a class="navbar-brand" href="#" style="font-size: 20px;">LifeCMS</a>
			</div>
			<div class="navbar-collapse collapse">
				<ul class="nav navbar-nav">
					<li {{IsActive('admin',$active)}}>
						<a href="{{site_url('category/admin')}}">后台首页</a>
					</li>
					<li {{IsActive('document',$active)}}>
						<a href="{{site_url('/document')}}">内容管理</a>
					</li>
					<li {{IsActive('category',$active)}}>
						<a href="{{site_url('/category')}}">栏目管理</a>
					</li>
					<li {{IsActive('user',$active)}}>
						<a href="{{site_url('/user')}}">用户管理</a>
					</li>
				</ul>
				<ul class="nav navbar-nav navbar-right">
					<li>
						<a href="#">欢迎你，{{$username}}</a>
					</li>
					<li>
						<a href="{{site_url('admin/logout')}}">注销登陆</a>
					</li>
				</ul>
				<ul class="nav navbar-nav navbar-right">
					<li>
						<a href="{{base_url()}}" target="__blank" style="color:#3071a9">网站首页</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="container panel" style="margin-top: 70px;padding-bottom: 20px;min-height:580px;">
			{{if !empty($info)}}
			{{include file="admin/admin_info.tpl"}}
			{{/if}}
			<h3>内容管理</h3>
			<div class="col-sm-3 content-sidebar">
				{{include file="admin/tree.tpl"}}
			</div>
			<div class="col-sm-9 content-main">
				<form action="{{site_url('document/Store')}}" method="post" enctype="multipart/form-data">
					<input id="method" type="hidden" name="Method" value="{{$Method}}"/>
					<input type="hidden" name="Id" value="{{$article.0.Id}}">
					<div class="form-group">
						<label>文章标题：</label>
						<input class="form-control" name="Title" value="{{$article.0.Title}}">
					</div>
					<div class="form-group">
						<label>所属栏目：</label>
						<select name="Pid" class="form-control">
							{{foreach $lastcate as $c}}
							<option value="{{$c.Id}}" {{if $article.0.Pid==$c.Id}}selected='selected'{{/if}} >{{$c.CateName}}</option>
							{{/foreach}}
						</select>
					</div>
					<div class="form-group">
						<label>关联栏目：</label>
						<select name="linkCate" class="form-control">
							<option value="无">无</option>
							{{foreach $lastcate as $c}}
							<option value="{{$c.Id}}" {{if $article.0.linkCate==$c.Id}}selected='selected'{{/if}} >{{$c.CateName}}</option>
							{{/foreach}}
						</select>
					</div>
					<div class="form-group">
						<label>是否置顶：</label>
						<select name="isTop" class="form-control">
							<option value="0">否</option>
							<option value="1">是</option>
						</select>
					</div>
					<div class="form-group">
						<label>来源：</label>
						<select name="Source" class="form-control">
							<option value="学院办公室" {{if $article.0.Source=="学院办公室"}}selected='selected'{{/if}} >学院办公室</option>
							<option value="人才与国际交流" {{if $article.0.Source=="人才国际与交流"}}selected='selected'{{/if}}>人才与国际交流</option>
							<option value="本科生教育" {{if $article.0.Source=="本科生教育"}}selected='selected'{{/if}}>本科生教育</option>
							<option value="研究生教育" {{if $article.0.Source=="研究生教育"}}selected='selected'{{/if}}>研究生教育</option>
							<option value="科学研究" {{if $article.0.Source=="科学研究"}}selected='selected'{{/if}}>科学研究</option>
							<option value="学生事务" {{if $article.0.Source=="学生事务"}}selected='selected'{{/if}}>学生事务</option>
							<option value="继续教育" {{if $article.0.Source=="继续教育"}}selected='selected'{{/if}}>继续教育</option>
							<option value="工程训练中心" {{if $article.0.Source=="工程训练中心"}}selected='selected'{{/if}}>工程训练中心</option>
						</select>
					</div>
					<div class="form-group">
						<label>发布时间：</label>
						<input class="form-control" name="PubTime" value="{{date('Y-m-d',$article.0.PubTime)}}">
					</div>
					<div class="form-group">
						<label>是否添加到重要通知：</label>
						<select name="tag" class="form-control">
							<option value="否" {{if $article.0.tag=="否"}}selected='selected'{{/if}}>否</option>
							<option value="是" {{if $article.0.tag=="是"}}selected='selected'{{/if}}>是</option>
						</select>
					</div>
					{{if !empty($hot)}}
					<div class="form-group">
						<label>上传图片：（此图片将被展示为首页轮换图）<span style="color:red;">(尺寸：700px * 300px)建议在chrome、360等浏览器下使用图片剪裁功能</span></label>

						<div class="crop-container">
						    <div class="imageBox">
						        <div class="thumbBox"></div>
						        <div class="spinner" style="display: none">Loading...</div>
						    </div>
						    <div class="action">
						    	<div class="buttonHolder">
						    		<input type="file" onchange="imageUploaded()" id="file" name="Image">
						    		<div class="button-mask imageUploaded">选择图片</div>
						    	</div>
						        <input type="button" id="btnCrop" value="剪裁" style="float: right">
						        <input type="button" id="btnZoomIn" value="+" style="float: right">
						        <input type="button" id="btnZoomOut" value="-" style="float: right">
						    </div>
						</div>
						<div class="cropped"></div>
						<input type="hidden" id="sw" name="sw"/>
						<input type="hidden" id="sh" name="sh"/>
						<input type="hidden" id="dx" name="dx"/>
						<input type="hidden" id="dy" name="dy"/>
						<input type="hidden" id="dw" name="dw"/>
						<input type="hidden" id="dh" name="dh"/>

					</div>
					{{/if}}
					<div class="form-group" style="width:726px;">
						<label>文章内容：<span style="color:red;">(推荐样式：字体：微软雅黑；字号：14px；行间距：2；)</span></label>
						<textarea id="container" name="Content">{{$article.0.Content}}</textarea>
							</div>
							<div class="submitHolder">
								<input type="submit" value="提交文章" class="document-edit-submit">
							</div>
						</form>
					</div>
					{{include file="admin/admin_modal.tpl"}}
				</div>
				<script src="{{base_url()}}Public/js/jquery.min.js"></script>
				<script src="{{base_url()}}Public/bootstrap/js/bootstrap.min.js"></script>
				<script src="{{base_url()}}Public/js/index.js"></script>
				<script>
					function modal(href)
					{
						$('#delete-url').attr('href',href);
						$('#myModal').modal();
					}
				</script>
				<script src="{{base_url()}}crop/cropbox.js"></script>
				<script type="text/javascript">
				    $(window).load(function() {
				        var options =
				        {
				            thumbBox: '.thumbBox',
				            spinner: '.spinner',
				            imgSrc: ''
				        }
				        var cropper = $('.imageBox').cropbox(options);
				        $('#file').on('change', function(){
				            var reader = new FileReader();
				            reader.onload = function(e) {
				                options.imgSrc = e.target.result;
				                cropper = $('.imageBox').cropbox(options);
				            }
				            reader.readAsDataURL(this.files[0]);
				            this.files = [];
				        })
				        $('#btnCrop').on('click', function(){

				            var img = cropper.getDataURL();
				            $('.cropped').append('<img src="'+img+'">');
				            $('.crop-container').hide();
				            var params = cropper.getParams();
				            $('#sw').val(params[0]);
				            $('#sh').val(params[1]);
				            $('#dx').val(params[2]);
				            $('#dy').val(params[3]);
				            $('#dw').val(params[4]);
				            $('#dh').val(params[5]);

				        })
				        $('#btnZoomIn').on('click', function(){
				            cropper.zoomIn();
				        })
				        $('#btnZoomOut').on('click', function(){
				            cropper.zoomOut();
				        })
				    });
				</script>
			</body>
		</html>


